﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
             xmlns:ee="http://schemas.microsoft.com/expression/2010/effects"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             xmlns:converters="clr-namespace:MainGameModule.Views.Converters"
             x:Class="MainGameModule.Views.ConnectView">

    <UserControl.Resources>
        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/YourWorld.Common;component/Styles/CommonResourcesDictionary.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
            <converters:IntToVisibilityConverter x:Key="IntToVisibilityConverter" />
            <converters:IntToVisibilityReverseConverter x:Key="IntToVisibilityReverseConverter" />

        </ResourceDictionary>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot"
          Width="600" Height="434">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Path x:Name="BackgroundRectangle" Grid.RowSpan="3"
              Data="M187.2383,141.7393C187.2383,141.7393,176.3913,144.7943,172.5713,149.0723C164.2383,158.4063,166.5713,209.7393,165.2383,221.7393C163.9053,233.7393,163.9053,364.4073,165.2383,397.0733C166.5713,429.7393,165.2383,441.7393,167.9053,452.4053C170.5713,463.0733,178.5713,462.4053,187.2383,465.7393C195.9053,469.0733,317.9053,475.0733,335.2383,475.0733C352.5713,475.0733,497.2383,476.4073,523.9053,475.0733C550.5723,473.7393,617.2393,476.4053,630.5723,469.7393C643.9053,463.0733,651.2383,452.4053,651.2383,435.7393C651.2383,419.0733,652.5713,301.0723,651.2383,249.0723C649.9053,197.0723,651.8313,159.3863,645.9053,150.4063C641.9333,144.3863,629.2383,143.7393,617.9053,141.7393C606.5723,139.7393,419.9053,137.7393,381.2383,138.4063C342.5713,139.0723,187.2383,141.7393,187.2383,141.7393z"
              Stretch="Fill">
            <Path.Effect>
                <DropShadowEffect Opacity="0.5" />
            </Path.Effect>
            <Path.Fill>
                <RadialGradientBrush RadiusX="0.8">
                    <GradientStop Color="#FFD1E778" />
                    <GradientStop Color="#FF4A6305"
                                  Offset="1" />
                </RadialGradientBrush>
            </Path.Fill>
        </Path>

        <Button Style="{StaticResource CloseButtonStyle}"
                Command="{Binding CloseCommand}">

        </Button>

        <Image Width="120"
               Height="120"
               Source="images/hand_red.png"
               Grid.RowSpan="2"
               HorizontalAlignment="Left"
               Opacity="0.595"
               VerticalAlignment="Top" d:IsHidden="True" />

        <TextBlock Margin="10"
                   FontFamily="Segoa UI"
                   FontSize="35"
                   Foreground="White"
                   FontWeight="ExtraBold"
                   Text="CONNECT"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center" d:IsHidden="True" />

        <Border Grid.Row="2"
                HorizontalAlignment="Right"
                Margin="10,15"
                VerticalAlignment="Bottom"
                BorderThickness="0.5"
                CornerRadius="15"
                Width="181"
                Height="147"
                BorderBrush="Black" d:IsHidden="True">
            <Border.Background>
                <ImageBrush Stretch="Fill"
                            ImageSource="images/hands_together.jpg" />
            </Border.Background>
        </Border>

        <StackPanel x:Name="ConnectedPlayerGrid"
                    Visibility="{Binding IsAlreadyConnected, Converter={StaticResource BoolToVisibilityConverter}}"
                    VerticalAlignment="Center"
                    Grid.Row="1"
                    Margin="5,5,200,5" d:IsHidden="True" >
            <TextBlock FontFamily="Segoa UI"
                       Foreground="White"
                       TextWrapping="Wrap">
            	<LineBreak /><Run Text=" Hi, " /><Run Text="{Binding OtherPlayerName}" /><Run Text=", You have already connected with " /><Run Text="{Binding Player.Name}" /><Run Text="!" />
				<LineBreak /><Run Text=" Go and connect with the other players on the map and you will form a team. When you work together in a team you can organize more quests. Go and find out about the quests." /></TextBlock>

            <Button                   HorizontalAlignment="Right"
                                      VerticalAlignment="Center"
                                      Margin="0,5,5,5"
                                      Content=" Quests "
                                      Command="{Binding ViewQuestsCommand}"
                                      Style="{StaticResource GwButtonStyle}" />
        </StackPanel>

        <StackPanel x:Name="ConnectTheSamePlayerGrid"
                    Visibility="{Binding IsConnectTheSamePlayer, Converter={StaticResource BoolToVisibilityConverter}}"
                    VerticalAlignment="Center"
                    Grid.Row="2"
                    Margin="5,5,200,5"
                    d:IsHidden="True">
            <TextBlock FontFamily="Segoa UI"
                       Foreground="White"
                       TextWrapping="Wrap"><LineBreak /><Run Text=" Hi, This Is YOU! " /><LineBreak /><Run Text=" Go and connect with the other players on the map and you will form a team. When you work together in a team you can organize more quests. Go and find out about the quests." /></TextBlock>
            <Button                   HorizontalAlignment="Right"
                                      VerticalAlignment="Center"
                                      Margin="0,5,5,5"
                                      Content="Quests"
                                      Command="{Binding ViewQuestsCommand}"
                                      Style="{StaticResource GwButtonStyle}" />
        </StackPanel>

        <StackPanel x:Name="ConnectAnotherPlayerPanel"
                    Visibility="{Binding IsConnectAnotherPlayer, Converter={StaticResource BoolToVisibilityConverter}}"
                    Grid.Row="1"
                    Margin="5" d:IsHidden="True">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Hi, "
                           FontFamily="Segoa UI"
                           Foreground="White"
                           TextWrapping="Wrap"
                           FontWeight="Bold" />
                <TextBlock Text="{Binding OtherPlayerName}"
                           FontFamily="Segoa UI"
                           Foreground="White"
                           TextWrapping="Wrap"
                           FontWeight="Bold" />
            </StackPanel>
            <TextBlock FontFamily="Segoa UI"
                       Foreground="White"
                       TextWrapping="Wrap">
            	
 	<LineBreak />
	<Run Text="To connect with another player means that you will agree to play together as a team. When you work together you can organize and take part in more interesting quests, learn to cooperate and have fun together. " />
            </TextBlock>

            <StackPanel Orientation="Horizontal">
                <TextBlock FontFamily="Segoa UI"
                           Foreground="White"
                           Text="Write a comment:"
                           VerticalAlignment="Center" />
                <TextBox Text="{Binding Comments, Mode=TwoWay}"
                         Width="400" />
            </StackPanel>

        </StackPanel>
        <Grid x:Name="ConnectAnotherPlayerGrid"
              Grid.Row="2"
              Visibility="{Binding ShowPlayerInfo, Converter={StaticResource BoolToVisibilityConverter}}" d:IsHidden="True">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <Image Width="100" Grid.RowSpan="2"
                   Height="100"
                   Source="{Binding Player.Image}" />

            <TextBlock Text="{Binding Player.Name}"
                       Grid.Row="1" VerticalAlignment="Center"
                       HorizontalAlignment="Center"
                       Foreground="White"
                       Margin="3"
                       FontSize="12"
                       FontWeight="Bold"
                       FontFamily="Segoe UI" />
            
            <StackPanel Grid.Column="1"
                        Margin="5,0,210,0">               
                <StackPanel Margin="0"
                            Orientation="Horizontal">
                    <TextBlock Text="Level: "
                               Foreground="White"
                               VerticalAlignment="Center"
                               FontSize="12"
                               FontFamily="Segoe UI" />
                    <ListBox ItemsSource="{Binding Player.GameLevelCollectionWorkaround}"
                             Background="Transparent" Margin="0" Padding="0"
                             BorderBrush="Transparent"
                             ItemContainerStyle="{StaticResource NoSelectionListBoxItemWOF}">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Horizontal" />
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Image Source="images/game_level_medal.png"
                                       Height="20"
                                       Width="20" />
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </StackPanel>

                <StackPanel Margin="0"
                            Orientation="Horizontal">
                    <TextBlock Text="Badges: "
                               VerticalAlignment="Center"
                               Foreground="White"
                               FontSize="12"
                               FontFamily="Segoe UI" />
                    <Grid>
                        <TextBlock Text="No items."
                                   HorizontalAlignment="Left"
                                   VerticalAlignment="Center"
                                   Foreground="White"
                                   Visibility="{Binding Player.BadgesCollection.Count, Converter={StaticResource IntToVisibilityReverseConverter}}"
                                   FontSize="14"
                                   FontFamily="Segoe UI" />
                        <ScrollViewer Width="250"
                                      Margin="0"
                                      Padding="0"
                                      Visibility="{Binding Player.BadgesCollection.Count, Converter={StaticResource IntToVisibilityConverter}}"
                                      BorderBrush="Transparent"
                                      Style="{StaticResource ListBoxScrollViewerStyle2}">
                            <ListBox ItemsSource="{Binding Player.BadgesCollection}"
                                     Background="Transparent"
                                     Margin="0"
                                     Padding="0"
                                     BorderBrush="Transparent"
                                     ItemContainerStyle="{StaticResource NoSelectionListBoxItemWOF}">
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Orientation="Horizontal"
                                                    ScrollViewer.VerticalScrollBarVisibility="Hidden"
                                                    ScrollViewer.HorizontalScrollBarVisibility="Auto" />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Image Source="{Binding Image}"
                                               Height="40"
                                               Width="40"
                                               ToolTipService.ToolTip="{Binding Title}"/>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </ScrollViewer>
                    </Grid>
                </StackPanel>

                <StackPanel Margin="0"                            
                            Orientation="Horizontal">
                    <TextBlock Text="Quests: "
                               VerticalAlignment="Center"
                               Foreground="White"
                               FontSize="12"
                               FontFamily="Segoe UI" />
                    <Grid>
                        <TextBlock Text="No items."
                                   HorizontalAlignment="Left"
                                   VerticalAlignment="Center"
                                   Foreground="White"
                                   Visibility="{Binding Player.QuestsCollection.Count, Converter={StaticResource IntToVisibilityReverseConverter}}"
                                   FontSize="14"
                                   FontFamily="Segoe UI" />
                        <ScrollViewer Width="250"
                                      Margin="0"
                                      Padding="0"
                                      BorderBrush="Transparent"
                                      Visibility="{Binding Player.QuestsCollection.Count, Converter={StaticResource IntToVisibilityConverter}}"
                                      Style="{StaticResource ListBoxScrollViewerStyle2}">
                            <ListBox ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                     ScrollViewer.VerticalScrollBarVisibility="Disabled"
                                     ItemsSource="{Binding Player.QuestsCollection}"
                                     Background="Transparent"
                                     BorderBrush="Transparent"
                                     Margin="0"
                                     Padding="0"
                                     ItemContainerStyle="{StaticResource NoSelectionListBoxItemWOF}">
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Orientation="Horizontal"
                                                    ScrollViewer.VerticalScrollBarVisibility="Hidden"
                                                    ScrollViewer.HorizontalScrollBarVisibility="Hidden" />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Image Source="{Binding Image}"
                                               Height="40"
                                               Width="40"
                                               ToolTipService.ToolTip="{Binding Title}"/>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </ScrollViewer>
                    </Grid>
                </StackPanel>

            </StackPanel>

            <Button Grid.Column="1" Grid.Row="1"
                    Visibility="{Binding IsConnectAnotherPlayer, Converter={StaticResource BoolToVisibilityConverter}}"
                    VerticalAlignment="Bottom"
                    Content=" Send Request "
                    Command="{Binding SendRequestCommand}"
                    Style="{StaticResource GwButtonStyle}"
                    Margin="0,0,210,10" HorizontalAlignment="Right" />
            <Button Grid.Column="1"
                    Grid.Row="1"
                    Visibility="{Binding IsConnectPlayerRequest, Converter={StaticResource BoolToVisibilityConverter}}"
                    VerticalAlignment="Bottom"
                    Content=" Confirm Request "
                    Command="{Binding ConfirmRequestCommand}"
                    Style="{StaticResource GwButtonStyle}"                    
                    Margin="10,0,0,10"
                    HorizontalAlignment="Left" />

            <Button Grid.Column="1"
                    Grid.Row="1"
                    Visibility="{Binding IsConnectPlayerResponseReceived, Converter={StaticResource BoolToVisibilityConverter}}"
                    VerticalAlignment="Bottom"
                    Content=" Quests "
                    Command="{Binding ViewQuestsCommand}"
                    Style="{StaticResource GwButtonStyle}"                    
                    Margin="134,0,0,10"
                    HorizontalAlignment="Left" />

        </Grid>

        <StackPanel x:Name="ConnectPlayerRequestPanel"
                    Visibility="{Binding IsConnectPlayerRequest, Converter={StaticResource BoolToVisibilityConverter}}"
                    Grid.Row="1"
                    Margin="5" d:IsHidden="True">
            <StackPanel Orientation="Horizontal" d:IsHidden="True">
                <TextBlock Text="Hi, "
                           FontFamily="Segoa UI"
                           Foreground="White"
                           TextWrapping="Wrap"
                           FontWeight="Bold" />
                <TextBlock Text="{Binding OtherPlayerName}"
                           FontFamily="Segoa UI"
                           Foreground="White"
                           TextWrapping="Wrap"
                           FontWeight="Bold" />
            </StackPanel>
            <TextBlock FontFamily="Segoa UI"
                       Foreground="White"
                       TextWrapping="Wrap">
 	<LineBreak />
 	<Run Text="{Binding Player.Name}"
                FontWeight="Bold" />
	<Run Text="wants to connect with YOU!" />
	<LineBreak />
	<Run Text="{Binding MessageComment}" />
 	<LineBreak />
	<Run Text="To connect with another player means that you will agree to play together as a team. When you work together you can organize and take part in more interesting quests, learn to cooperate and have fun together. " />
            </TextBlock>

            <StackPanel Orientation="Horizontal">
                <TextBlock FontFamily="Segoa UI"
                           Foreground="White"
                           Text="Write a comment:"
                           VerticalAlignment="Center" />
                <TextBox Text="{Binding Comments, Mode=TwoWay}"
                         Width="400" />
            </StackPanel>

        </StackPanel>


        <StackPanel x:Name="ConnectPlayerResponsePanel"
                    Visibility="{Binding IsConnectPlayerResponseReceived, Converter={StaticResource BoolToVisibilityConverter}}"
                    Grid.Row="1"
                    Margin="5" d:IsHidden="True">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Hi, "
                           FontFamily="Segoa UI"
                           Foreground="White"
                           TextWrapping="Wrap"
                           FontWeight="Bold" />
                <TextBlock Text="{Binding OtherPlayerName}"
                           FontFamily="Segoa UI"
                           Foreground="White"
                           TextWrapping="Wrap"
                           FontWeight="Bold" />
            </StackPanel>
            <TextBlock FontFamily="Segoa UI"
                       Foreground="White"
                       TextWrapping="Wrap">
 	<LineBreak />
 	<Run Text="{Binding Player.Name}"
                FontWeight="Bold" />
	<Run Text=" has just agreed to be a part of your team!" />
	<LineBreak />
	<Run Text="{Binding MessageComment}" />
 	<LineBreak />
	<Run Text="To connect with another player means that you will agree to play together as a team. When you work together you can organize and take part in more interesting quests, learn to cooperate and have fun together. " />
            </TextBlock>
        </StackPanel>

    </Grid>
</UserControl>
